/*
 * Yonghuzhuce.java
 *
 * Created on __DATE__, __TIME__
 *  */

package WindowsModule;

import java.awt.event.MouseListener;
import java.util.Arrays;
import java.util.List;

import javax.swing.JOptionPane;

import Client.ClientListener;
import Client.MsgEvent;
import Tools.ToCenter;
import Windows.MainWindows;
import Windows.PicPanel;
import Windows.ShowWindows.ShowWindow;
import XML.Like;

/**
 * 
 * @author __USER__
 */
public class Yonghuzhuce extends javax.swing.JFrame implements ClientListener {

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			@Override
			public void run() {
				new Yonghuzhuce().setVisible(true);
			}
		});
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.ButtonGroup buttonGroup1;

	private javax.swing.ButtonGroup buttonGroup2;

	private javax.swing.JButton jButton1;

	private javax.swing.JButton jButton2;

	private javax.swing.JCheckBox jCheckBox1;

	private javax.swing.JCheckBox jCheckBox2;

	private javax.swing.JCheckBox jCheckBox3;

	private javax.swing.JCheckBox jCheckBox4;

	private javax.swing.JCheckBox jCheckBox5;

	private javax.swing.JComboBox jComboBox1;

	private javax.swing.JComboBox jComboBox2;

	private javax.swing.JComboBox jComboBox3;

	private javax.swing.JComboBox jComboBox4;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel10;
	private javax.swing.JLabel jLabel11;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel13;
	private javax.swing.JLabel jLabel14;
	private javax.swing.JLabel jLabel15;
	private javax.swing.JLabel jLabel16;
	private javax.swing.JLabel jLabel17;
	private javax.swing.JLabel jLabel18;
	private javax.swing.JLabel jLabel19;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel20;
	private javax.swing.JLabel jLabel21;
	private javax.swing.JLabel jLabel22;
	private javax.swing.JLabel jLabel23;
	private javax.swing.JLabel jLabel24;
	private javax.swing.JLabel jLabel25;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JLabel jLabel9;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JPanel jPanel2;
	private javax.swing.JPasswordField jPasswordField1;
	private javax.swing.JPasswordField jPasswordField2;
	private javax.swing.JRadioButton jRadioButton1;
	private javax.swing.JRadioButton jRadioButton2;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JTabbedPane jTabbedPane1;
	private javax.swing.JTextArea jTextArea1;
	private javax.swing.JTextField jTextField1;
	private javax.swing.JTextField jTextField10;
	private javax.swing.JTextField jTextField11;
	private javax.swing.JTextField jTextField12;
	private javax.swing.JTextField jTextField2;
	private javax.swing.JTextField jTextField3;
	private javax.swing.JTextField jTextField7;
	private javax.swing.JTextField jTextField8;
	private javax.swing.JTextField jTextField9;
	/** Creates new form Yonghuzhuce */
	public Yonghuzhuce() {

		jPanel1 = new PicPanel("Skin/WindowGray.JPG", "Skin/Window.jpg");
		jPanel2 = new PicPanel("Skin/showWindowGray.JPG", "Skin/showWindow2.jpg");
		setContentPane(new PicPanel("Skin/speed.JPG"));

		initComponents();
		MainWindows.getInstance().client.addClientListenser(this);

		getinit();
		getYear();
		getMonth();
		String y = jComboBox1.getSelectedItem().toString();
		String m = jComboBox3.getSelectedItem().toString();
		int year = Integer.parseInt(y);
		int month = Integer.parseInt(m);
		createday(year, month);
		ToCenter.ToCenter(this);

		this.addWindowListener(ShowWindow.getOpacityWindowsListener());

		MouseListener ml = ((PicPanel) jPanel1).getMouseListener();

		jComboBox1.addMouseListener(ml);
		jComboBox2.addMouseListener(ml);
		jComboBox3.addMouseListener(ml);
		jComboBox4.addMouseListener(ml);

		jLabel15.addMouseListener(ml);
		jLabel16.addMouseListener(ml);
		jLabel17.addMouseListener(ml);
		jLabel18.addMouseListener(ml);
		jLabel19.addMouseListener(ml);
		jLabel2.addMouseListener(ml);
		jLabel20.addMouseListener(ml);
		jLabel21.addMouseListener(ml);
		jLabel22.addMouseListener(ml);
		jLabel23.addMouseListener(ml);
		jLabel24.addMouseListener(ml);
		jLabel25.addMouseListener(ml);
		jLabel4.addMouseListener(ml);
		jLabel5.addMouseListener(ml);
		jLabel6.addMouseListener(ml);
		jLabel7.addMouseListener(ml);
		jLabel8.addMouseListener(ml);
		jLabel9.addMouseListener(ml);
		jPanel1.addMouseListener(ml);
		jRadioButton1.addMouseListener(ml);
		jRadioButton2.addMouseListener(ml);
		jScrollPane1.addMouseListener(ml);
		jTextArea1.addMouseListener(ml);
		jTextField10.addMouseListener(ml);
		jTextField11.addMouseListener(ml);
		jTextField12.addMouseListener(ml);
		jTextField2.addMouseListener(ml);
		jTextField3.addMouseListener(ml);
		jTextField7.addMouseListener(ml);
		jTextField8.addMouseListener(ml);
		jTextField9.addMouseListener(ml);
		jCheckBox1.addMouseListener(ml);
		jCheckBox2.addMouseListener(ml);
		jCheckBox3.addMouseListener(ml);
		jCheckBox4.addMouseListener(ml);
		jCheckBox5.addMouseListener(ml);
		jRadioButton1.addMouseListener(ml);
		jRadioButton2.addMouseListener(ml);

		ml = ((PicPanel) jPanel2).getMouseListener();
		jLabel1.addMouseListener(ml);
		jLabel2.addMouseListener(ml);
		jLabel3.addMouseListener(ml);
		jLabel7.addMouseListener(ml);
		jLabel13.addMouseListener(ml);
		jLabel17.addMouseListener(ml);
		jLabel20.addMouseListener(ml);
		jLabel21.addMouseListener(ml);
		jLabel23.addMouseListener(ml);
		jLabel24.addMouseListener(ml);
		jLabel25.addMouseListener(ml);
		jTextField1.addMouseListener(ml);
		jPasswordField1.addMouseListener(ml);
		jPasswordField2.addMouseListener(ml);
		jTextField10.addMouseListener(ml);
		jTextField12.addMouseListener(ml);
		jTextField8.addMouseListener(ml);
		jTextField9.addMouseListener(ml);
	}
	public void createday(int year, int month) {
		jComboBox4.removeAllItems();
		switch (month) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			int day = 31;
			for (int i = 1; i <= day; i++) {
				jComboBox4.addItem(i);
			}
			break;

		case 2:
			if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)) {
				day = 29;
				for (int i = 1; i <= day; i++) {
					jComboBox4.addItem(i);
				}
			} else {
				day = 28;
				for (int i = 1; i <= day; i++) {
					jComboBox4.addItem(i);
				}
			}
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			day = 30;
			for (int i = 1; i <= day; i++) {
				jComboBox4.addItem(i);
			}
			break;
		}

	}
	@Override
	public void dispose() {
		MainWindows.getInstance().client.removeClientListenser(this);
		super.dispose();
	}
	public void getinit() {
		MainWindows.getInstance().client.send("<zhuce cmd=\"shen\"/>");

	}
	// 获得月份
	public void getMonth() {
		for (int m = 1; m <= 12; m++) {
			jComboBox3.addItem(m);
		}

	}
	// (x%4==0) && (x%100!=0) || (x%400==0)
	// {
	// if((x%4==0) && (x%100!=0) || (x%400==0))
	// {
	// printf("闰年！");
	// }
	// else
	// {
	// printf("平年！");28天
	// }
	// }
	// 获得生日中的年
	public void getYear() {

		for (int i = 1950; i < 2100; i++) {

			jComboBox1.addItem(i);
		}
	}
	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		buttonGroup1 = new javax.swing.ButtonGroup();
		buttonGroup2 = new javax.swing.ButtonGroup();
		jButton1 = new javax.swing.JButton();
		jButton2 = new javax.swing.JButton();
		jTabbedPane1 = new javax.swing.JTabbedPane();

		jTextField1 = new javax.swing.JTextField();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jPasswordField1 = new javax.swing.JPasswordField();
		jPasswordField2 = new javax.swing.JPasswordField();
		jLabel13 = new javax.swing.JLabel();
		jLabel1 = new javax.swing.JLabel();
		jTextField8 = new javax.swing.JTextField();
		jLabel7 = new javax.swing.JLabel();
		jLabel20 = new javax.swing.JLabel();
		jTextField9 = new javax.swing.JTextField();
		jLabel24 = new javax.swing.JLabel();
		jTextField10 = new javax.swing.JTextField();
		jLabel21 = new javax.swing.JLabel();
		jLabel23 = new javax.swing.JLabel();
		jTextField12 = new javax.swing.JTextField();
		jLabel25 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();

		jLabel5 = new javax.swing.JLabel();
		jTextField2 = new javax.swing.JTextField();
		jLabel6 = new javax.swing.JLabel();
		jLabel8 = new javax.swing.JLabel();
		jLabel9 = new javax.swing.JLabel();
		jLabel10 = new javax.swing.JLabel();
		jLabel11 = new javax.swing.JLabel();
		jLabel12 = new javax.swing.JLabel();
		jCheckBox1 = new javax.swing.JCheckBox();
		jCheckBox2 = new javax.swing.JCheckBox();
		jCheckBox3 = new javax.swing.JCheckBox();
		jCheckBox4 = new javax.swing.JCheckBox();
		jCheckBox5 = new javax.swing.JCheckBox();
		jTextField3 = new javax.swing.JTextField();
		jLabel14 = new javax.swing.JLabel();
		jLabel15 = new javax.swing.JLabel();
		jLabel16 = new javax.swing.JLabel();
		jLabel17 = new javax.swing.JLabel();
		jComboBox2 = new javax.swing.JComboBox();
		jLabel18 = new javax.swing.JLabel();
		jLabel19 = new javax.swing.JLabel();
		jLabel22 = new javax.swing.JLabel();
		jScrollPane1 = new javax.swing.JScrollPane();
		jTextArea1 = new javax.swing.JTextArea();
		jTextField7 = new javax.swing.JTextField();
		jTextField11 = new javax.swing.JTextField();
		jComboBox1 = new javax.swing.JComboBox();
		jComboBox3 = new javax.swing.JComboBox();
		jComboBox4 = new javax.swing.JComboBox();
		jRadioButton1 = new javax.swing.JRadioButton();
		jRadioButton2 = new javax.swing.JRadioButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		setTitle("\u7528\u6237\u6ce8\u518c");
		setResizable(false);

		jButton1.setText("\u6ce8 \u518c");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			@Override
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
		});

		jButton2.setText("\u91cd \u7f6e");
		jButton2.addActionListener(new java.awt.event.ActionListener() {
			@Override
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton2ActionPerformed(evt);
			}
		});

		jLabel2.setText("\u7528\u6237\u540d\uff1a");

		jLabel3.setText("\u5bc6\u7801\uff1a");

		jLabel13.setText("\u786e\u8ba4\u5bc6\u7801\uff1a");

		jLabel1.setFont(new java.awt.Font("宋体", 1, 18));
		jLabel1.setText("\u7528\u6237\u6ce8\u518c");

		jLabel7.setText("*\u90ae\u7bb1\u5730\u5740\uff1a");

		jLabel20.setText("*\u5bc6\u7801\u63d0\u95ee\uff1a");

		jLabel24.setText("\u5305\u542b\u201c@\u201d\u548c\u201c.\u201d");

		jLabel21.setText("*\u63d0\u95ee\u7b54\u6848\uff1a");

		jLabel23.setText("\u9080\u8bf7\u7801\uff1a");

		jLabel25.setText("\u9009\u586b");

		jLabel4.setFont(new java.awt.Font("宋体", 0, 11));
		jLabel4.setForeground(new java.awt.Color(255, 102, 102));
		jLabel4.setText("\u5e26*\u53f7\u4e3a\u5fc5\u586b");

		javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				javax.swing.GroupLayout.Alignment.TRAILING,
				jPanel2Layout
						.createSequentialGroup()
						.addContainerGap(137, Short.MAX_VALUE)
						.addGroup(
								jPanel2Layout
										.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
										.addGroup(jPanel2Layout.createSequentialGroup().addGap(84, 84, 84).addComponent(jLabel1))
										.addGroup(
												jPanel2Layout
														.createSequentialGroup()
														.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel23).addComponent(jLabel7).addComponent(jLabel20).addComponent(jLabel21).addComponent(jLabel13).addComponent(jLabel2).addComponent(jLabel3))
														.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
														.addGroup(
																jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel25))
																		.addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false).addComponent(jTextField10, javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTextField9, javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTextField8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel24))
																		.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false).addComponent(jPasswordField2, javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPasswordField1, javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))))).addGap(118, 118, 118)));
		jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel2Layout
						.createSequentialGroup()
						.addGap(44, 44, 44)
						.addComponent(jLabel1)
						.addGap(18, 18, 18)
						.addGroup(
								jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel13).addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
										.addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel3).addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(26, 26, 26))).addGap(11, 11, 11).addComponent(jLabel4).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel7).addComponent(jLabel24)).addGap(7, 7, 7).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel20)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel21)).addGap(19, 19, 19).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel23).addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel25)).addContainerGap(53, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u57fa\u672c\u8d44\u6599", jPanel2);

		jPanel1.setForeground(new java.awt.Color(255, 255, 255));

		jLabel5.setText("\u6635\u79f0\uff1a");

		jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
		jLabel6.setText("\u751f\u65e5\uff1a");

		jLabel8.setText("\u661f\u5ea7\uff1a");

		jLabel9.setText("\u8840\u578b\uff1a");

		jLabel10.setText("\u6240\u5728\u57ce\u5e02\uff1a");

		jLabel11.setText("\u6027\u522b\uff1a");

		jLabel12.setText("\u7231\u597d\uff1a");

		jCheckBox1.setText("\u770b\u5c0f\u8bf4");

		jCheckBox2.setText("\u65c5\u6e38");

		jCheckBox3.setText("\u97f3\u4e50");

		jCheckBox4.setText("\u8fd0\u52a8");

		jCheckBox5.setText("\u5176\u5b83");

		jLabel14.setText("\u5e74");

		jLabel15.setText("\u6708");

		jLabel16.setText("\u65e5");

		jLabel17.setText("\u578b");

		jLabel18.setText("\u7701");

		jLabel19.setText("\u5e02");

		jLabel22.setText("\u4e2a\u4eba\u8bf4\u660e\uff1a");

		jTextArea1.setColumns(20);
		jTextArea1.setRows(5);
		jScrollPane1.setViewportView(jTextArea1);

		jComboBox1.addItemListener(new java.awt.event.ItemListener() {
			@Override
			public void itemStateChanged(java.awt.event.ItemEvent evt) {
				jComboBox1ItemStateChanged(evt);
			}
		});
		jComboBox1.addActionListener(new java.awt.event.ActionListener() {
			@Override
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jComboBox1ActionPerformed(evt);
			}
		});

		jComboBox3.addItemListener(new java.awt.event.ItemListener() {
			@Override
			public void itemStateChanged(java.awt.event.ItemEvent evt) {
				jComboBox3ItemStateChanged(evt);
			}
		});
		jComboBox3.addActionListener(new java.awt.event.ActionListener() {
			@Override
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jComboBox3ActionPerformed(evt);
			}
		});

		buttonGroup1.add(jRadioButton1);
		jRadioButton1.setText("\u7537");

		buttonGroup1.add(jRadioButton2);
		jRadioButton2.setText("\u5973");

		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel1Layout
						.createSequentialGroup()
						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel22).addComponent(jLabel11).addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE).addComponent(jLabel5).addComponent(jLabel12).addComponent(jLabel9).addComponent(jLabel10))
						.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								jPanel1Layout
										.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
										.addGroup(
												jPanel1Layout
														.createSequentialGroup()
														.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
														.addGroup(
																jPanel1Layout
																		.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
																		.addGroup(
																				jPanel1Layout
																						.createSequentialGroup()
																						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jComboBox2, 0, 63, Short.MAX_VALUE).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel17).addGap(6, 6, 6)).addComponent(jCheckBox1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE))
																						.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addGap(2, 2, 2).addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jLabel8).addComponent(jCheckBox2))
																						.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																						.addGroup(
																								jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jCheckBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jCheckBox4).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jCheckBox5, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE))
																										.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE).addComponent(jTextField11, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel19).addGap(102, 102, 102)))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jRadioButton1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jRadioButton2))
																		.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)))
										.addGroup(
												jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false).addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup().addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel14).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
														.addComponent(jLabel15).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel16).addGap(122, 122, 122))).addGap(75, 75, 75)));
		jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel1Layout.createSequentialGroup().addGap(20, 20, 20).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel5)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel14).addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel15).addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel16).addComponent(jLabel6)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel11).addComponent(jRadioButton1).addComponent(jRadioButton2)).addGap(6, 6, 6).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jCheckBox2).addComponent(jCheckBox4).addComponent(jCheckBox5).addComponent(jLabel12).addComponent(jCheckBox1).addComponent(jCheckBox3)).addGap(6, 6, 6)
						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel9).addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel17).addComponent(jLabel8).addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel10).addComponent(jLabel19).addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel18)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel22).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(58, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u8be6\u7ec6\u8d44\u6599", jPanel1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(147, 147, 147).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(45, 45, 45).addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 587, javax.swing.GroupLayout.PREFERRED_SIZE));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 385, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)).addContainerGap(22, Short.MAX_VALUE)));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents
	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
		String id = jTextField1.getText();// 获得用户名
		String pass1 = jPasswordField1.getText();// 获得密码
		String password = jPasswordField2.getText();
		String name = jTextField2.getText();// 获得昵称
		int year = Integer.parseInt(jComboBox1.getSelectedItem().toString());// 年

		int month = Integer.parseInt(jComboBox3.getSelectedItem().toString());// 月

		int day = Integer.parseInt(jComboBox4.getSelectedItem().toString());// 日

		// if(year<1900||month<1||day<1){
		// JOptionPane.showMessageDialog(null, "no");
		// return;
		// }
		// 获得性别
		String sex = "";
		if (jRadioButton1.isSelected()) {
			sex = "男";
		} else {
			if (jRadioButton2.isSelected()) {
				sex = "女";
			}
		}
		// 获得爱好
		String aihao = "";
		if (jCheckBox1.isSelected()) {
			aihao += jCheckBox1.getText();
		}
		if (jCheckBox2.isSelected()) {
			aihao += jCheckBox2.getText();
		}
		if (jCheckBox3.isSelected()) {
			aihao += jCheckBox3.getText();
		}
		if (jCheckBox4.isSelected()) {
			aihao += jCheckBox4.getText();
		}
		if (jCheckBox5.isSelected()) {
			aihao += jCheckBox5.getText();
		}
		String blood = jTextField3.getText();// 获得血型
		String xingzuo = jTextField7.getText();// 获得星座
		int province = jComboBox2.getSelectedIndex() + 1;// 获得地址（省）
		String city = jTextField11.getText();
		;// 获得市
			// String Address = Address1 + Address2;
		String Email = jTextField8.getText();
		String Tiwen = jTextField9.getText();// 提问
		String daan = jTextField10.getText();// 答案
		String myself = jTextArea1.getText();// 个人说明
		String introId = jTextField12.getText();
		if (id.equals("") || pass1.equals("") || password.equals("")) {
			JOptionPane.showMessageDialog(null, "用户名和密码不能为空");
			return;
		} else {

//			if (db.isSelect(id)) {
//				JOptionPane.showMessageDialog(null, "用户名已存在");
//				jTextField1.setText("");
//			} else {
			if (Email.equals("") || Tiwen.equals("") || daan.equals("")) {
				JOptionPane.showMessageDialog(null, "带*号为必填选项");
			} else {
				if (!Like.like("%@%.%", Email)) {
					JOptionPane.showMessageDialog(null, "邮箱地址不合法");
					jTextField8.setText("");
				} else {
					if (!pass1.equals(password)) {
						JOptionPane.showMessageDialog(null, "确认密码和密码必须相同");
						jPasswordField1.setText("");
						jPasswordField2.setText("");
					} else {
						if (!introId.equals("") && (introId.equals(id))) {
							JOptionPane.showMessageDialog(null, "介绍人不合法");
							jTextField12.setText("");
						} else {
							StringBuffer sb = new StringBuffer("<zhuce cmd=\"submit\" ");
							sb.append("value=\"");
							sb.append(Arrays.toString(new Object[] { id, password, name, sex, year, month, day, xingzuo, aihao, Email, Tiwen, daan, blood, province, city, myself, introId }));
							sb.append("\" />");

							MainWindows.getInstance().client.send(sb);

							jButton1.setEnabled(false);

//								if (db.isInsert(id, password, name, sex, year,
//										month, day, xingzuo, aihao, Email,
//										Tiwen, daan, blood, province, city,
//										myself, introId)) {
//									JOptionPane.showMessageDialog(null,
//											"恭喜！系统以成功接受您的注册。");
//									this.setVisible(false);
//									// Yonghudenglu y = new Yonghudenglu();
//									// y.setVisible(true);
//								}

						}
					}
				}

//				}
			}
		}
	}
	private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
		jTextField1.setText("");
		jPasswordField1.setText("");
		jPasswordField2.setText("");
		jTextField2.setText("");
		// jTextField4.setText("");
		// jTextField5.setText("");
		// jTextField6.setText("");

		// jRadioButton1.setSelected(false);
		//
		// jRadioButton2.setSelected(false);

		jCheckBox1.setSelected(false);
		jCheckBox2.setSelected(false);
		jCheckBox3.setSelected(false);
		jCheckBox4.setSelected(false);
		jCheckBox5.setSelected(false);
		jTextField3.setText("");
		// 星座
		// jComboBox1
		// 省
		// jComboBox2
		// jTextField7.setText("");
		jTextField8.setText("");
		jTextField9.setText("");
		jTextField10.setText("");
		jTextArea1.setText("");

	}
	private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}
	private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {
		// TODO add your handling code here:
		if (this.isVisible()) {
			String y = jComboBox1.getSelectedItem().toString();
			String m = jComboBox3.getSelectedItem().toString();
			int year = Integer.parseInt(y);
			int month = Integer.parseInt(m);
			createday(year, month);
		}
	}
	private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jComboBox3ItemStateChanged(java.awt.event.ItemEvent evt) {
		// TODO add your handling code here:
		if (this.isVisible()) {
			String y = jComboBox1.getSelectedItem().toString();
			String m = jComboBox3.getSelectedItem().toString();
			int year = Integer.parseInt(y);
			int month = Integer.parseInt(m);
			createday(year, month);
		}
	}

	@Override
	public void onCloseEvent(Client.CloseEvent cce) {
		// TODO Auto-generated method stub

	}

	// End of variables declaration//GEN-END:variables
	@Override
	public void onMsgEvent(MsgEvent ce) {
		if ("zhuce".equals(ce.getCmd().FLAG)) {
			if (ce.getCmd().get("cmd").equals("shen")) {
				List<String> rs = Arrays.asList(ce.getCmd().get("value").toString().split(","));
				try {
					for (String shen : rs) {
						jComboBox2.addItem(shen);
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			} else if (ce.getCmd().get("cmd").equals("submit")) {
				jButton1.setEnabled(true);
				if (ce.getCmd().get("value").equals("true")) {
					JOptionPane.showMessageDialog(null, "恭喜，注册成功！");
					this.setVisible(false);
				} else {
					JOptionPane.showMessageDialog(null, "对不起，注册失败！");
				}

			}
		}
	}

}